﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Dyan.PlatformSystem.Migrations
{
    public partial class CustomerBaseInfo : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "CustomerAccounts",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    Name = table.Column<string>(maxLength: 50, nullable: true),
                    Email = table.Column<string>(maxLength: 50, nullable: true),
                    PhoneNum = table.Column<string>(maxLength: 20, nullable: true),
                    PassWord = table.Column<string>(maxLength: 30, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CustomerAccounts", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "CustomerBaseInfos",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    Name = table.Column<string>(maxLength: 50, nullable: true),
                    PhoneNum = table.Column<string>(maxLength: 20, nullable: true),
                    Email = table.Column<string>(maxLength: 20, nullable: true),
                    Company = table.Column<string>(maxLength: 100, nullable: true),
                    Address = table.Column<string>(maxLength: 100, nullable: true),
                    Sex = table.Column<string>(maxLength: 2, nullable: true),
                    Age = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CustomerBaseInfos", x => x.Id);
                });

            migrationBuilder.CreateIndex(
                name: "IX_CustomerAccounts_TenantId",
                table: "CustomerAccounts",
                column: "TenantId");

            migrationBuilder.CreateIndex(
                name: "IX_CustomerBaseInfos_TenantId",
                table: "CustomerBaseInfos",
                column: "TenantId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "CustomerAccounts");

            migrationBuilder.DropTable(
                name: "CustomerBaseInfos");
        }
    }
}
